import logging

from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from portal import model
from portal.lib.base import BaseController, render

log = logging.getLogger(__name__)

class CompagnieController(BaseController):

    def index(self, page):
        q = model.Session.query(model.Page).filter(model.Page.name == page)
        c.page = q.first()
        
        return render('/compagnie/compagnie.mako')
    
    def programmation(self):
        q = model.Session.query(model.Programmation)
        c.programmations = q.limit(20)
        
        return render('/compagnie/programmation.mako')
    
    def programmation_view(self, param):
        q = model.Session.query(model.Programmation).filter(model.Programmation.id == param)
        c.programmation = q.first()

        return render('/compagnie/programmation_view.mako')